using AndroidCaller;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NavigationController : MonoBehaviour
{
	public DialogController DialogController;

	public GarageController GarageController;

    private MyAdManager adManage;

    private void Start()
    {
        adManage = new MyAdManager();
    }
    private void Update()
	{
		if (UnityEngine.Input.GetKeyDown(KeyCode.Escape))
		{
			Back();
		}
	}

	public void Back()
	{
		if (DialogController.dialog_showing)
		{
			DialogController.HideAllDialogs();
			return;
		}
		LoadingPanel.GetInstance().Show();
		SceneManager.LoadScene("Menu");
	}

	public void PlayClick()
	{
		if (PlayerPrefs.GetInt("vehicle_" + GarageController.active + "_unlocked", 0) == 1)
		{
			PlayerPrefs.SetInt("selected_vehicle", GarageController.active);
			//NativeCall.Call("garageclosed");
			LoadingPanel.GetInstance().Show();
			SceneManager.LoadScene("SelectLevel");
            adManage.MyShowNative();
        }
	}
}
